<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Travian::Building - a package that defines a Travian building.</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body style="background-color: white">

<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#methods">METHODS</a></li>
	<ul>

		<li><a href="#new__"><code>new()</code></a></li>
		<li><a href="#gid__"><code>gid()</code></a></li>
		<li><a href="#name__"><code>name()</code></a></li>
		<li><a href="#costs__"><code>costs()</code></a></li>
		<li><a href="#times__"><code>times()</code></a></li>
		<li><a href="#max_lvl__"><code>max_lvl()</code></a></li>
		<li><a href="#total_cost__"><code>total_cost()</code></a></li>
		<li><a href="#parse_construction__"><code>parse_construction()</code></a></li>
	</ul>

	<li><a href="#parse_functions">PARSE FUNCTIONS</a></li>
	<ul>

		<li><a href="#parse_construction_costs__"><code>parse_construction_costs()</code></a></li>
		<li><a href="#parse_construction_times__"><code>parse_construction_times()</code></a></li>
	</ul>

	<li><a href="#functions">FUNCTIONS</a></li>
	<ul>

		<li><a href="#gid2name__"><code>gid2name()</code></a></li>
		<li><a href="#name2gid__"><code>name2gid()</code></a></li>
		<li><a href="#time2secs__"><code>time2secs()</code></a></li>
	</ul>

	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#see_also">SEE ALSO</a></li>
	<li><a href="#copyright_and_license">COPYRIGHT AND LICENSE</a></li>
</ul>
<!-- INDEX END -->

<hr />
<p>
</p>
<h2><a name="name">NAME</a></h2>
<p>Travian::Building - a package that defines a Travian building.</p>
<p>
</p>
<hr />
<h2><a name="synopsis">SYNOPSIS</a></h2>
<pre>
  use Travian::Building;
  my $building = Travian::Building-&gt;new(35);
  print $building-&gt;gid();
  print $building-&gt;name();
  print $building-&gt;level();</pre>
<pre>
  print $building-&gt;costs($level)-&gt;wood();
  foreach my $cost (@{$building-&gt;costs()})
  {
    print $cost-&gt;wood();
  }</pre>
<pre>
  print $building-&gt;times($level, $mb_level);</pre>
<p>
</p>
<hr />
<h2><a name="description">DESCRIPTION</a></h2>
<p>This package is for a single building in Travian.</p>
<p>
</p>
<hr />
<h2><a name="methods">METHODS</a></h2>
<p>
</p>
<h3><a name="new__"><code>new()</code></a></h3>
<pre>
  use Travian::Building;</pre>
<pre>
  my $building = Travian::Building-&gt;new($gid);</pre>
<p>
</p>
<h3><a name="gid__"><code>gid()</code></a></h3>
<pre>
  $building-&gt;gid();</pre>
<p>Returns the gid of this building.</p>
<p>
</p>
<h3><a name="name__"><code>name()</code></a></h3>
<pre>
  $building-&gt;name();</pre>
<p>Returns the name of this building.</p>
<p>
</p>
<h3><a name="costs__"><code>costs()</code></a></h3>
<pre>
  $building-&gt;costs();
  $building-&gt;costs($level);</pre>
<p>Returns the building costs for the given level.
Return value is of type Travian::Building::Cost.
If no argument is given returns an array ref for all levels of build.</p>
<p>
</p>
<h3><a name="times__"><code>times()</code></a></h3>
<pre>
  $building-&gt;times();
  $building-&gt;times($level);
  $building-&gt;times($level, $mb_level);</pre>
<p>Returns the build time for the given level and main building level.
If no main building level is given returns an array ref of build times for $level.
If no argument is given returns an array ref for all levels of build.</p>
<p>
</p>
<h3><a name="max_lvl__"><code>max_lvl()</code></a></h3>
<pre>
  $building-&gt;max_lvl();</pre>
<p>Returns the maximum build level listed for this building.</p>
<p>
</p>
<h3><a name="total_cost__"><code>total_cost()</code></a></h3>
<pre>
  $building-&gt;total_cost();
  $building-&gt;total_cost(25);
  $building-&gt;total_cost(1, 25);</pre>
<p>Returns the total build costs for the given build levels.
The above examples are all interchangeable.</p>
<p>
</p>
<h3><a name="parse_construction__"><code>parse_construction()</code></a></h3>
<pre>
  $building-&gt;parse_construction($construction_html);
  
Parses the given construction html and populates this building with costs and times.
Returns this building.</pre>
<p>
</p>
<hr />
<h2><a name="parse_functions">PARSE FUNCTIONS</a></h2>
<p>
</p>
<h3><a name="parse_construction_costs__"><code>parse_construction_costs()</code></a></h3>
<pre>
  &amp;parse_construction_costs($construction_costs_html);
  
Parses the given construction costs html and returns an array ref of costs.
Used by $building-&gt;parse_construction().</pre>
<p>
</p>
<h3><a name="parse_construction_times__"><code>parse_construction_times()</code></a></h3>
<pre>
  &amp;parse_construction_times($construction_times_html);
  
Parses the given construction times html and returns an array ref of times.
Used by $building-&gt;parse_construction().</pre>
<p>
</p>
<hr />
<h2><a name="functions">FUNCTIONS</a></h2>
<p>
</p>
<h3><a name="gid2name__"><code>gid2name()</code></a></h3>
<pre>
  &amp;gid2name($gid);
  
Returns the building's name for the given gid.</pre>
<p>
</p>
<h3><a name="name2gid__"><code>name2gid()</code></a></h3>
<pre>
  &amp;name2gid($name);
  
Returns the building's gid for the given name.</pre>
<p>
</p>
<h3><a name="time2secs__"><code>time2secs()</code></a></h3>
<pre>
  &amp;time2secs($time);
  
Given a time in format h:m:s returns number of seconds.</pre>
<p>
</p>
<hr />
<h2><a name="author">AUTHOR</a></h2>
<p>Adrian D. Elgar, &lt;<a href="mailto:ade@wasters.com">ade@wasters.com</a>&gt;
Martin Robertson, &lt;<a href="mailto:marley@wasters.com">marley@wasters.com</a>&gt;</p>
<p>
</p>
<hr />
<h2><a name="see_also">SEE ALSO</a></h2>
<p>Travian::Building::Cost</p>
<p>
</p>
<hr />
<h2><a name="copyright_and_license">COPYRIGHT AND LICENSE</a></h2>
<p>Copyright (C) 2007 by Adrian Elgar, Martin Robertson</p>
<p>This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.8 or,
at your option, any later version of Perl 5 you may have available.</p>

</body>

</html>
